package ch1.base;

/**
 * 线程优先级   值越高越有概率先执行
 */
public class UsePriority {
    private static class PiriotyThread extends Thread{
        @Override
        public void run() {
            System.out.println(Thread.currentThread().getName() + "线程调用");
        }
    }

    public static void main(String[] args) {
        PiriotyThread piriotyThread = new PiriotyThread();
        String name1 = piriotyThread.getName();
        System.out.println(name1);
        piriotyThread.start();

        PiriotyThread piriotyThread2 = new PiriotyThread();
        String name2 = piriotyThread2.getName();
        System.out.println(name2);
        piriotyThread2.setPriority(10);
        piriotyThread2.start();
    }
}